<template>
  <div style="background:#fff;height:calc(100vh - 140px);padding-top:20px ;">

    <a-form-model :model="form" :labelCol=" { span: 2 }" :wrapperCol="{ span: 8 }" :rules="rules" ref="ruleForm">
      <a-form-model-item label="登录帮助设置：" prop="content">
        <a-textarea v-model="form.content" placeholder="请输入登录帮助的信息内容" :auto-size="{ minRows: 6, maxRows: 16 }"></a-textarea>
      </a-form-model-item>
      <a-form-model-item :wrapperCol=" { span: 14, offset: 2 }">
        <a-button type="primary" @click="submit">发布</a-button>
      </a-form-model-item>
    </a-form-model>

  </div>
</template>

<script>

import { postAction, getAction } from '@/api/manage'


export default {
  name: 'loginHelp',
  data() {
    return {
      description: '登陆帮助设置',
      form: {
        content: '',
      },
      rules: {
        content: [{ required: true, message: "请输入登录帮助的信息内容", trigger: 'blur' }]

      }
    }
  },
  created() {
    this.getData()
  },

  methods: {
    getData() {
      let params = {
        pageNo: 1,
        pageSize: 1
      }
      getAction('/sys/sysLoginHelp/list',params).then(res=>{
        this.form.content = res.result.records[0].content
      })
    },
    submit() {
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          let params = {
            id:'1',
            content: this.form.content,
          }
          postAction('/sys/sysLoginHelp/edit', params).then((res) => {
            if (res && res.code == 200) {
              this.$message.success('发布成功')
              this.getData()
            }
          })
        }
      });
    }


  }
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';

.history-title {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 20px;
  .title-text {
    font-size: 16px;
    font-weight: 700;
    color: #000;
  }
}
</style>